package models

import (
	"time"
)

type Question struct {
	ID            uint      `gorm:"primarykey" json:"id"`
	Title         string    `gorm:"size:100;not null" json:"title"`
	Description   string    `gorm:"type:text" json:"description,omitempty"`
	QuestionerID  uint      `json:"questionerId"`
	AnswerCount   int       `gorm:"default:0" json:"answerCount"`
	FollowerCount int       `gorm:"default:0" json:"followerCount"`
	CreatedAt     time.Time `json:"createdAt"`
	UpdatedAt     time.Time `json:"updatedAt"`
	
	// 关联
	Questioner  User      `gorm:"foreignKey:QuestionerID" json:"questioner,omitempty"`
	Topics      []*Topic  `gorm:"many2many:question_topics" json:"topics,omitempty"`
	Answers     []*Answer `json:"answers,omitempty"`
	Followers   []*User   `gorm:"many2many:user_following_questions" json:"followers,omitempty"`
} 